package csc.traning.wpsj.dao;

import java.io.Serializable;

public class FileInformation  implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String path;
	private String name;
	private boolean isDirectory;
	private String size;
	private String modified = null;
	/**
	 * @return the path
	 */
	public String getPath() {
		return path;
	}
	/**
	 * @param path the path to set
	 */
	public void setPath(String path) {
		this.path = path;
	}
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return the isDirectory
	 */
	public boolean getIsDirectory() {
		return isDirectory;
	}
	/**
	 * @param isDirectory the isDirectory to set
	 */
	public void setIsDirectory(boolean isDirectory) {
		this.isDirectory = isDirectory;
	}
	/**
	 * @return the size
	 */
	public String getSize() {
		return size;
	}
	/**
	 * @param size the size to set
	 */
	public void setSize(long size) {
		double convertSize;
		if (size>1024*1024) {
			convertSize = size * 1.0/ (1024*1024);
			this.size = String.format("%.1f", convertSize) + " MB";
		} else if (size > 1024) {
			convertSize = size * 1.0 / 1024;
			this.size = String.format("%.0f", convertSize) + " KB";
		} else {
			convertSize = size * 1.0;
			this.size = String.format("%.0f", convertSize) + " Byte";
		}

	}
	/**
	 * @return the modified
	 */
	public String getModified() {
		return modified;
	}
	/**
	 * @param modified the modified to set
	 */
	public void setModified(String modified) {
		this.modified = modified;
	}
}
